import { BaseWindow } from "../../../../component/window/BaseWindow";
import { ILayer } from "../../../../mvc/interfaces/ILayer";
import { Language } from "../../../../../extend/language/Language";
import { EffectManager } from "../../../manager/EffectManager";
import { FilterConst } from "../../../../component/gconst/FilterConst";
import { TweenMax } from "../../../../../com/greensock/TweenMax";
import { ItemData } from "../../../resource/info/ItemData";
import { ItemsUtil } from "../../shortcuts/item/ItemsUtil";
import { PetLifeStyleHuntConfig } from "../../../resource/PetLifeStyleHuntConfig";
import { PetMingUtil } from "../info/PetMingUtil";
import { Cache } from "../../../cache/Cache";
import { PetMingItemData } from "../info/PetMingItemData";
import { GImageBitmap } from "../../../../../com/mui/controls/GImageBitmap";
import { ImagesConst } from "../../../resource/ImagesConst";
import { ObjCreate } from "../../common/ObjCreate";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { TilePanel } from "../../equipment/TilePanel";
import { PetMingItemCellRenderer } from "./PetMingItemCellRenderer";
import { GTextFormat } from "../../../../common/GTextFormat";
import { FontUtil } from "../../../../common/font/FontUtil";
import { ResFileConst } from "../../../resource/ResFileConst";
import { PulseSharedObject } from "../../player/PulseSharedObject";
import { PetMingJuLevelItem } from "./PetMingJuLevelItem";
import { PetMingJuLevelInfo } from "../info/PetMingJuLevelInfo";
import { GuideTips } from "../../guide/GuideTips";
import { GuideTipsManager } from "../../../manager/GuideTipsManager";
import { PetMingEatItem } from "./PetMingEatItem";
import { PetMingMsgRollTips } from "./PetMingMsgRollTips";
import { LoaderHelp } from "../../../../common/display/LoaderHelp";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { Button } from "../../../../../fl/controls/Button";
import { MsgManager } from "../../../manager/MsgManager";
import { EPlayerItemPosType } from "../../../../../Message/Public/EPlayerItemPosType";
import { Alert } from "../../../../../com/mui/controls/Alert";
import { CheckBoxWin } from "../../common/alertwins/CheckBoxWin";
import { GuideArrowManager } from "../../../manager/GuideArrowManager";
import { GuidePetLifeStyleRule } from "../../../rules/GuidePetLifeStyleRule";
import { MaskInfo } from "../../effect/MaskInfo";
import { DataProvider } from "../../../../../fl/data/DataProvider";
import { ECategory } from "../../../../../Message/Public/ECategory";
import { EProp } from "../../../../../Message/Public/EProp";
import { GTextFiled } from "../../../../../com/mui/controls/GTextFiled";
import { GButton } from "../../../../../com/mui/controls/GButton";
import { GLoadedButton } from "../../../../../com/mui/controls/GLoadedButton";
import { GCheckBox } from "../../../../../com/mui/controls/GCheckBox";
import { 5 } from "../../../../../0/5";
import { _EPlayerItemPosTypePetLifeStypeHunt } from "../../../../../EPlayerItemPosType/_EPlayerItemPosTypePetLifeStypeHunt";
import { _EPlayerItemPosTypePetLifeStypePut } from "../../../../../EPlayerItemPosType/_EPlayerItemPosTypePetLifeStypePut";
type int = number;
//class PetMingJuWindow
    
    export  class PetMingJuWindow extends BaseWindow
    {
        constructor(arg1: ILayer=null)
        {
            super(arg1);
            this._levelItemArray = [];
            this.dealUidArray = [];
            this.setSize(785, 540);
            this.titleHeight = 28;
            this.title = Language.getString(54741);
            return;
        }

        public glowBrokenSoul(arg1: int): void
        {
            if (arg1 > 0) 
            {
                EffectManager.glowFilterReg(this._suipianLabel, [FilterConst.taskShowTargetFilter], 0.6, 10, 5, 3);
                EffectManager.glowFilterReg(this._suipianTxt, [FilterConst.taskShowTargetFilter], 0.6, 10, 5, 3);
                this._msgRollTips.showMsg(Language.getStringByParam(54782, arg1), 4);
                this._flyIcon.visible = true;
                TweenMax.to(this._flyIcon, 1.5, {"x": 270, "y": 40, "scaleX": 5, "scaleY": 5, "onComplete": this.flyComplete, "onCompleteParams":[this._flyIcon]});
            }
            return;
        }

        /* internal  */flyComplete(arg1: Object /* flash.display.Bitmap */): void
        {
            this._flyIcon.x = 450;
            this._flyIcon.y = 455;
            this._flyIcon.scaleX = 1;
            this._flyIcon.scaleY = 1;
            this._flyIcon.visible = false;
            return;
        }

        public updateSwallExp(arg1: int): void
        {
            this._expTxt.text = arg1.toString();
            return;
        }

        public dealGetItem(arg1: ItemData, arg2: int=-1, arg3: Boolean=false): void
        {
            var loc3=0;
            var loc4=null;
            var loc5=null;
            var loc6=null;
            var loc7=null;
            var loc8=null;
            var loc9=null;
            var loc11=null;
            var loc1=Language.getStringByParam(54770, ItemsUtil.getItemName(arg1));
            var loc2="";
            if (arg3) 
            {
                loc3 = arg2 + 1;
                loc11 = PetLifeStyleHuntConfig.instance.getPetLifeStyleHuntByLevel(loc3);
                loc2 = Language.getString(54771) + PetMingUtil.getHuntLevelName(loc11);
            }
            loc1 = loc1 + loc2;
            this._msgRollTips.showMsg(loc1, arg2);
            if (!Cache.instance.petMing.isOnekeyJu) 
            {
                return;
            }
            var loc10=1;
            while (loc10 <= 5) 
            {
                loc7 = (loc6 = this._levelItemArray[(loc10 - 1)]).levelInfo;
                if (loc10 != arg2) 
                {
                    if (loc10 != 1) 
                    {
                        loc7.isCanPropCall = false;
                    }
                    else 
                    {
                        loc7.isCanPropCall = true;
                    }
                    loc7.isMaxCanPropCall = false;
                    loc6.updateByLevelInfo(loc7);
                }
                else 
                {
                    loc7.isCanPropCall = true;
                    loc7.isMaxCanPropCall = true;
                    loc6.updateByLevelInfo(loc7);
                }
                ++loc10;
            }
            return;
        }

        /* internal  */onTimerHandler(arg1: Object /* flash.events.TimerEvent */): void
        {
            var loc1=this.playArray[this.playIndex];
            var loc2=Cache.instance.pack.petMingJuPackCache.getItemByCodeNotEqualUid(loc1.itemCode, this.dealUidArray);
            if (loc2) 
            {
                this.dealUidArray.push(loc2.uid);
                this.dealGetItem(loc2, loc1.level, loc1.isOpenNext);
                this._mingItemsList.dataProvider.addItem(new PetMingItemData(loc2.data));
                var loc3;
                var loc4=((loc3 = this).playIndex + 1);
                loc3.playIndex = loc4;
            }
            return;
        }

        /* internal  */onReplayCompleteHandler(arg1: Object /* flash.events.TimerEvent */): void
        {
            Cache.instance.petMing.isDoReplay = false;
            if (this._mingItemsList.dataProvider.length == 0) 
            {
                this.dealUidArray = [];
            }
            flash.utils.setTimeout(this.resetByHuntLevelInfo, this._delay);
            return;
        }

        /* internal  */resetByHuntLevelInfo(): void
        {
            var loc2=null;
            var loc3=null;
            var loc4=null;
            var loc5=0;
            var loc1=Cache.instance.petMing.huntLevelInfo;
            if (loc1) 
            {
                loc4 = loc1.levelArray;
                loc5 = 0;
                while (loc5 < 5) 
                {
                    loc2 = this._levelItemArray[loc5];
                    loc3 = loc2.levelInfo;
                    loc3.reset();
                    loc3.level = loc5 + 1;
                    loc2.updateByLevelInfo(loc3);
                    ++loc5;
                }
            }
            return;
        }

        public doReplay(arg1: Array<any>): void
        {
            this.playArray = arg1;
            this.playIndex = 0;
            if (arg1.length == 1) 
            {
                this.onTimerHandler(null);
                return;
            }
            if (!this.playTimer) 
            {
                this.playTimer = new Object /* flash.utils.Timer */(this._delay);
                this.playTimer.addEventListener(flash.events.TimerEvent.TIMER, this.onTimerHandler);
                this.playTimer.addEventListener(flash.events.TimerEvent.TIMER_COMPLETE, this.onReplayCompleteHandler);
            }
            this.playTimer.repeatCount = arg1.length;
            this.playTimer.reset();
            this.playTimer.start();
            Cache.instance.petMing.isDoReplay = true;
            return;
        }

        protected /* override */ createChildren(): void
        {
            var loc2=false;
            var loc4=null;
            var loc5=null;
            var loc7=null;
            super.createChildren();
            this.addChild(new GImageBitmap(ImagesConst.PetMingLieBg, 17, 39));
            this._topSprite = new Object /* flash.display.Sprite */();
            this._topSprite.x = 20;
            this._topSprite.y = 50;
            this.addChild(this._topSprite);
            ObjCreate.createBg(0, 0, 100, 25, this._topSprite, ImagesConst.DisabledBg);
            ObjCreate.createBitmap(ImagesConst.Yuanbao, 5, 5, this._topSprite);
            ObjCreate.createBg(105, 0, 100, 25, this._topSprite, ImagesConst.DisabledBg);
            ObjCreate.createBg(210, 0, 130, 25, this._topSprite, ImagesConst.DisabledBg);
            this._goldTxt = ObjCreate.createGTextField("", 30, 5, 100, 20, this._topSprite, GlobalStyle.textFormatOrange);
            this._goldTxt.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._propLabel = ObjCreate.createGTextField(Language.getString(54772), 110, 5, 90, 20, this._topSprite, GlobalStyle.textFormat6);
            this._propLabel.toolTipData = Language.getString(54773);
            this._propNumTxt = ObjCreate.createGTextField("", 175, 5, 70, 25, this._topSprite, GlobalStyle.textFormatOrange);
            this._propNumTxt.mouseEnabled = false;
            this._suipianLabel = ObjCreate.createGTextField(Language.getString(54744), 215, 5, 120, 20, this._topSprite, GlobalStyle.textFormat6);
            this._suipianLabel.toolTipData = Language.getString(54787);
            this._suipianTxt = ObjCreate.createGTextField("", 275, 5, 100, 20, this._topSprite, GlobalStyle.textFormatOrange);
            this._suipianTxt.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._exchangeBtn = ObjCreate.createGButton(Language.getString(54762), 350, 0, 50, 28, this._topSprite, "ArenaRedBtn");
            this._exchangeBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onExchangeClickHandler);
            this._mingItemsList = new TilePanel();
            this._mingItemsList.setSize(720, 190);
            this._mingItemsList.columnWidth = 88;
            this._mingItemsList.rowHeight = 95;
            this._mingItemsList.setStyle("cellRenderer", PetMingItemCellRenderer);
            this._mingItemsList.move(30, 88);
            this.addChild(this._mingItemsList);
            var loc1=new GTextFormat(FontUtil.xingkaiName, 24, 65280);
            this._timesTxt = ObjCreate.createGTextField("1", 203, 375, 25, 25, this, loc1);
            this._timesTxt.autoSize = flash.text.TextFieldAutoSize.CENTER;
            this._onekeyJuBtn = ObjCreate.createGLoadedButton(ResFileConst.PetMingOneKeyJu, 300, 340, 121, 42, this);
            this._onekeyJuBtn.name = "ju";
            this._onekeyJuBtn.toolTipData = Language.getString(54774);
            this._onekeyGetBtn = ObjCreate.createGLoadedButton(ResFileConst.PetMingOneKeyGet, 410, 340, 121, 42, this);
            this._onekeyGetBtn.name = "get";
            this._onekeyGetBtn.toolTipData = Language.getString(54801);
            this._onekeyEatBtn = ObjCreate.createGLoadedButton(ResFileConst.PetMingOneKeyEat, 520, 340, 121, 42, this);
            this._onekeyEatBtn.name = "eat";
            this._onekeyEatBtn.toolTipData = Language.getString(54802);
            this._packBtn = ObjCreate.createGLoadedButton(ResFileConst.PetMingPack, 630, 340, 121, 42, this);
            this._packBtn.name = "pack";
            this._onekeyJuBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onBtnClickHandler);
            this._onekeyGetBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onBtnClickHandler);
            this._onekeyEatBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onBtnClickHandler);
            this._packBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onBtnClickHandler);
            this._getCheckBox = ObjCreate.createCheckBox(Language.getString(54775), 405, 382, 130, 28, this, "GCheckBoxGreen");
            this._eatCheckBox = ObjCreate.createCheckBox(Language.getString(54776), 525, 382, 130, 28, this, "GCheckBoxGreen");
            if (PulseSharedObject.getValue(PetMingJuWindow.GET_KEY) != null) 
            {
                loc2 = PulseSharedObject.getValue(PetMingJuWindow.GET_KEY) as Boolean;
            }
            var loc3=true;
            if (PulseSharedObject.getValue(PetMingJuWindow.EAT_KEY) != null) 
            {
                loc3 = PulseSharedObject.getValue(PetMingJuWindow.EAT_KEY) as Boolean;
            }
            this._getCheckBox.selected = loc2;
            this._eatCheckBox.selected = loc3;
            this._getCheckBox.addEventListener(flash.events.Event.CHANGE, this.onGetCheckBoxChangeHandler);
            this._eatCheckBox.addEventListener(flash.events.Event.CHANGE, this.onEatCheckBoxChangeHandler);
            this._leftBitmap = new Object /* flash.display.Bitmap */();
            this._leftBitmap.x = 640;
            this._leftBitmap.y = 310;
            this.addChild(this._leftBitmap);
            this._packLeftNumTxt = ObjCreate.createGTextField("", 642, 323, 45, 20, this, GlobalStyle.textFormatGreen);
            this._packLeftNumTxt.autoSize = flash.text.TextFieldAutoSize.CENTER;
            var loc6=this.getLevelItemPos();
            var loc8=0;
            while (loc8 < 5) 
            {
                loc7 = loc6[loc8];
                (loc4 = new PetMingJuLevelItem()).x = loc7.x;
                loc4.y = loc7.y;
                this.addChild(loc4);
                this._levelItemArray.push(loc4);
                (loc5 = new PetMingJuLevelInfo()).level = loc8 + 1;
                loc4.updateByLevelInfo(loc5);
                ++loc8;
            }
            this._flyIcon = new Object /* flash.display.Bitmap */();
            this._flyIcon.x = 450;
            this._flyIcon.y = 455;
            this._flyIcon.visible = false;
            this.addChild(this._flyIcon);
            this._guideTips = new GuideTips();
            this._guideTips.updateTxt(Language.getStringByParam(54913, this._halfTime, this._halfTime));
            this._guideTips.updateDir(GuideTipsManager.Dir_TL);
            this._guideTips.x = 415;
            this._guideTips.y = 518;
            this.addChild(this._guideTips);
            ObjCreate.createGTextField(Language.getString(54777), 690, 495, 130, 20, this, GlobalStyle.textFormatGreen);
            this._eatMingBaseItem = new PetMingEatItem();
            this._eatMingBaseItem.move(680, 430);
            this.addChild(this._eatMingBaseItem);
            this._expTxt = ObjCreate.createGTextField("", 676, 510, 80, 20, this, GlobalStyle.textFormat6);
            this._expTxt.autoSize = flash.text.TextFieldAutoSize.CENTER;
            this._expTxt.htmlText = "";
            this._msgRollTips = new PetMingMsgRollTips();
            this._msgRollTips.x = 33;
            this._msgRollTips.y = 425;
            this.addChild(this._msgRollTips);
            LoaderHelp.addResCallBack(ResFileConst.PetMing, this.onLoadedHandler);
            return;
        }

        /* internal  */getLevelItemPos(): Array<any>
        {
            var loc1=[];
            loc1.push(new Object /* flash.geom.Point */(30, 435));
            loc1.push(new Object /* flash.geom.Point */(155, 445));
            loc1.push(new Object /* flash.geom.Point */(280, 410));
            loc1.push(new Object /* flash.geom.Point */(405, 418));
            loc1.push(new Object /* flash.geom.Point */(535, 418));
            return loc1;
        }

        /* internal  */onLoadedHandler(): void
        {
            this._flyIcon.bitmapData = GlobalClass.getBitmapData(ImagesConst.PetMingFlyIcon);
            this._leftBitmap.bitmapData = GlobalClass.getBitmapData(ImagesConst.PetMingPackCapacity);
            return;
        }

        /* internal  */onExchangeClickHandler(arg1: Object /* flash.events.Event */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.PetMingExchangeWindowOpen));
            return;
        }

        /* internal  */onBtnClickHandler(arg1: Object /* flash.events.Event */): void
        {
            var loc2=false;
            var loc3=0;
            var loc4=0;
            var loc5=null;
            var loc6=0;
            if (Cache.instance.petMing.isDoReplay) 
            {
                return;
            }
            var loc1=(arg1.target as Button).name;
            if (loc1 != "ju") 
            {
                if (loc1 != "get") 
                {
                    if (loc1 != "eat") 
                    {
                        if (loc1 == "pack") 
                        {
                            Dispatcher.dispatchEvent(new DataEvent(EventName.PetMingMoudleOpen));
                        }
                    }
                    else 
                    {
                        flash.utils.setTimeout(this.onekeyEatHander, 300);
                    }
                }
                else 
                {
                    loc2 = this._getCheckBox.selected;
                    if (loc2) 
                    {
                        loc3 = 4;
                        loc4 = 5;
                    }
                    else 
                    {
                        loc3 = 0;
                        loc4 = 5;
                    }
                    if ((loc5 = this.getBagItemDict(loc3, loc4, false)) == null || loc5 && int(loc5["itemLen"]) == 0) 
                    {
                        MsgManager.showRollTipsMsg(Language.getString(54780));
                        return;
                    }
                    Dispatcher.dispatchEvent(new DataEvent(EventName.PetMingOneKeyGet, {"fromPosType": _EPlayerItemPosTypePetLifeStypeHunt, "toPosType": _EPlayerItemPosTypePetLifeStypePut, "itemUidDict": loc5["itemDict"], "callBackFun": this.onekeyGetSuccess}));
                }
            }
            else 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.PetMingOneKeyJu, {"level": 0, "type": 0}));
            }
            return;
        }

        /* internal  */onekeyEatHander(): void
        {
            var isSelect2: Boolean;
            var startColor2: int;
            var endColor2: int;
            var eatBagDict: Map<any, any> /* flash.utils.Dictionary */;
            var exp: int;
            var showTipFinishHander: Function;
            var isNeedAlert: Boolean;

            var loc1;
            startColor2 = 0;
            endColor2 = 0;
            eatBagDict = null;
            exp = 0;
            showTipFinishHander = null;
            showTipFinishHander = (arg1: int, arg2: Boolean): void
            {
                if (arg1 == Alert.OK) 
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.PetMingEat, {"fromPosType": _EPlayerItemPosTypePetLifeStypeHunt, "fromPetUid":"", "itemDict": eatBagDict["itemDict"], "callBackFun": onkeyEatSuccess, "exp": exp}));
                }
                if (arg2) 
                {
                    PulseSharedObject.save("PetMingJuOnekeyEat", true);
                }
                return;
            }
            isSelect2 = this._eatCheckBox.selected;
            if (isSelect2) 
            {
                startColor2 = 0;
                endColor2 = 3;
            }
            else 
            {
                startColor2 = 0;
                endColor2 = 5;
            }
            eatBagDict = this.getBagItemDict(startColor2, endColor2);
            if (eatBagDict == null || eatBagDict && int(eatBagDict["exp"]) == 0) 
            {
                MsgManager.showRollTipsMsg(Language.getString(54781));
                return;
            }
            exp = eatBagDict["exp"] as int;
            isNeedAlert = !PulseSharedObject.isTodayNotTips("PetMingJuOnekeyEat");
            if (!isSelect2 && isNeedAlert && eatBagDict["hasPurple"] == true) 
            {
                Alert.resetToDefault();
                Alert.alertWinRenderer = CheckBoxWin;
                Alert.show(Language.getString(54915), null, Alert.OK | Alert.CANCEL, null, showTipFinishHander);
            }
            else 
            {
                showTipFinishHander(Alert.OK, false);
            }
            return;
        }

        /* internal  */onekeyGetSuccess(arg1: Map<any, any> /* flash.utils.Dictionary */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.PetMingOnkeyGetSuccess, arg1));
            return;
        }

        /* internal  */onkeyEatSuccess(arg1: Map<any, any> /* flash.utils.Dictionary */, arg2: int): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.PetMingOnkeyEatSuccess, arg1));
            flash.utils.setTimeout(PetMingUtil.showAddExpEffect, 1500, arg2);
            return;
        }

        /* internal  */getBagItemDict(arg1: int, arg2: int, arg3: Boolean=true): Map<any, any> /* flash.utils.Dictionary */
        {
            var loc2=null;
            var loc3=null;
            var loc4=0;
            var loc6=0;
            var loc7=null;
            var loc8=0;
            var loc1=[];
            var loc5;
            if ((loc5 = this._mingItemsList.dataProvider.toArray()).length > 0) 
            {
                loc2 = new Map<any, any> /* flash.utils.Dictionary */();
                loc3 = new Map<any, any> /* flash.utils.Dictionary */();
                loc8 = 0;
                while (loc8 < loc5.length) 
                {
                    if ((loc7 = loc5[loc8]).color >= arg1 && loc7.color <= arg2) 
                    {
                        if (!(!arg3 && loc7.isExpLifeStyle)) 
                        {
                            loc3[loc7.uid] = loc7.itemAmount;
                            loc4 = loc4 + (loc7.effect + loc7.lsExp);
                            ++loc6;
                            if (loc7.color >= 4) 
                            {
                                loc2["hasPurple"] = true;
                            }
                            loc1.push(loc7.uid);
                        }
                    }
                    ++loc8;
                }
                loc2["itemDict"] = loc3;
                loc2["exp"] = loc4;
                loc2["itemLen"] = loc6;
            }
            return loc2;
        }

        /* internal  */onGetCheckBoxChangeHandler(arg1: Object /* flash.events.Event */): void
        {
            var loc1=this._getCheckBox.selected;
            PulseSharedObject.saveValue(PetMingJuWindow.GET_KEY, loc1);
            return;
        }

        /* internal  */onEatCheckBoxChangeHandler(arg1: Object /* flash.events.Event */): void
        {
            var loc1=this._eatCheckBox.selected;
            PulseSharedObject.saveValue(PetMingJuWindow.EAT_KEY, loc1);
            return;
        }

        public /* override */ hide(): void
        {
            super.hide();
            if (this._closeGuide) 
            {
                this._closeGuide = false;
                GuideArrowManager.hideGuideArrow();
            }
            return;
        }

        public guideLifeStyleOpt(arg1: int): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=null;
            var loc4=null;
            var loc5=null;
            var loc6=null;
            if (arg1 != GuidePetLifeStyleRule.StepLifeStyleOpt1) 
            {
                if (arg1 == GuidePetLifeStyleRule.StepLifeStyleOpt2) 
                {
                    loc1 = this._levelItemArray[1];
                    loc3 = localToGlobal(new Object /* flash.geom.Point */(loc1.x + 20, loc1.y));
                }
            }
            else 
            {
                loc1 = this._levelItemArray[0];
                loc4 = localToGlobal(new Object /* flash.geom.Point */(20, 30));
                loc2 = new MaskInfo();
                loc2.width = 750;
                loc2.height = 300;
                loc2.x = loc4.x;
                loc2.y = loc4.y;
                loc3 = localToGlobal(new Object /* flash.geom.Point */(loc1.x + 22, loc1.y - 5));
            }
            if (loc1 != null) 
            {
                this.hideGuide();
                loc1.guideLifeStyleOpt(arg1);
                (loc5 = new MaskInfo()).width = 66;
                loc5.height = 66;
                loc5.x = loc3.x;
                loc5.y = loc3.y;
                loc3 = localToGlobal(new Object /* flash.geom.Point */(757, 5));
                (loc6 = new MaskInfo()).width = _closeBtn.width;
                loc6.height = _closeBtn.height;
                loc6.x = loc3.x;
                loc6.y = loc3.y;
                if (loc2) 
                {
                    EffectManager.addUIMask([loc5, loc6, loc2], 10000);
                }
                else 
                {
                    EffectManager.addUIMask([loc5, loc6], 10000);
                }
            }
            return;
        }

        public guideLifeStyleGet(arg1: int): void
        {
            this.hideGuide();
            this.refreshJuPack();
            var loc1=localToGlobal(new Object /* flash.geom.Point */(20, 30));
            var loc2=new MaskInfo();
            loc2.width = 750;
            loc2.height = 300;
            loc2.x = loc1.x;
            loc2.y = loc1.y;
            loc1 = localToGlobal(new Object /* flash.geom.Point */(757, 5));
            var loc3;
            (loc3 = new MaskInfo()).width = _closeBtn.width;
            loc3.height = _closeBtn.height;
            loc3.x = loc1.x;
            loc3.y = loc1.y;
            EffectManager.addUIMask([loc2, loc3], 10000);
            return;
        }

        public guideLifeStyleClose(): void
        {
            var loc1=GuideArrowManager.getGuideArrow(GuideArrowManager.Dir_R);
            loc1.x = _closeBtn.x;
            loc1.y = _closeBtn.y + 10;
            $addChild(loc1);
            this._closeGuide = true;
            return;
        }

        public updateBrokenSoul(arg1: int): void
        {
            this._suipianTxt.text = arg1.toString();
            return;
        }

        /* internal  */hideGuide(): void
        {
            var loc1=this._levelItemArray[0];
            loc1.guideHide();
            loc1 = this._levelItemArray[1];
            loc1.guideHide();
            return;
        }

        public updateGoldJuTime(arg1: int): void
        {
            return;
        }

        public refreshJuPack(arg1: Boolean=false): void
        {
            var loc3=null;
            var loc1=Cache.instance.pack.petMingJuPackCache;
            var loc2=loc1.getAllItems();
            var loc4=[];
            var loc5=0;
            while (loc5 < loc2.length) 
            {
                if (loc3 = loc2[loc5] as ItemData) 
                {
                    loc4.push(new PetMingItemData(loc3.data));
                }
                ++loc5;
            }
            this._mingItemsList.dataProvider = new DataProvider(loc4);
            this._mingItemsList.invalidateList();
            return;
        }

        public updateByHuntLevelInfo(): void
        {
            var loc2=0;
            var loc3=null;
            var loc4=null;
            var loc5=null;
            var loc6=0;
            var loc1=Cache.instance.petMing.huntLevelInfo;
            if (loc1) 
            {
                loc2 = loc1.juTimes > 0 ? 0 : 1;
                this._timesTxt.text = loc2.toString();
                loc5 = loc1.levelArray;
                loc6 = 0;
                while (loc6 < 5) 
                {
                    loc3 = this._levelItemArray[loc6];
                    (loc4 = loc3.levelInfo).level = loc6 + 1;
                    loc3.updateByLevelInfo(loc4);
                    if (loc6 == 3 && Cache.instance.petMing.discountActiveOpen) 
                    {
                        this._guideTips.updateTxt(Language.getStringByParam(54938, PetMingUtil.discountActivePrice, ItemsUtil.getItemName(loc4.costItemData), loc4.huntInfo.itemCost));
                        this._guideTips.updateDir(GuideTipsManager.Dir_TL);
                    }
                    ++loc6;
                }
            }
            return;
        }

        public updateGold(arg1: int): void
        {
            this._goldTxt.text = arg1.toString();
            return;
        }

        public updatePropNum(): void
        {
            var loc1=Cache.instance.pack.backPackCache.getItemCountByCategoryAndType(ECategory._ECategoryProp, EProp._EPropLifeStyleHunt);
            this._propNumTxt.text = loc1.toString();
            return;
        }

        public updateLifeStyleNum(): void
        {
            var loc1=Cache.instance.pack.petMingPackCache.getItemCountByJudge(ItemsUtil.isPetLifeStyle);
            var loc2=Cache.instance.petMing.packCapacity - loc1;
            if (loc2 > 0) 
            {
                this._packLeftNumTxt.text = loc2.toString();
            }
            else 
            {
                this._packLeftNumTxt.text = Language.getString(54805);
            }
            return;
        }

        public /* override */ show(arg1: int=0, arg2: int=0): void
        {
            super.show(arg1, arg2);
            this.refreshJuPack();
            this.updateByHuntLevelInfo();
            this.updateGold(Cache.instance.role.money.gold);
            this.updatePropNum();
            this.updateBrokenSoul(Cache.instance.role.money.brokenSoul);
            this.updateSwallExp(Cache.instance.petMing.swallExp);
            this.updateLifeStyleNum();
            return;
        }

        /* internal */ static /* const */GET_KEY: string="PetMingJu_get";

        /* internal */ static /* const */EAT_KEY: string="PetMingJu_eat";

        /* internal */ /* var */_topSprite: Object /* flash.display.Sprite */;

        /* internal */ /* var */_goldTxt: GTextFiled;

        /* internal */ /* var */_propLabel: GTextFiled;

        /* internal */ /* var */_propNumTxt: GTextFiled;

        /* internal */ /* var */_leftBitmap: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_packLeftNumTxt: GTextFiled;

        /* internal */ /* var */_suipianLabel: GTextFiled;

        /* internal */ /* var */_exchangeBtn: GButton;

        /* internal */ /* var */_mingItemsList: TilePanel;

        /* internal */ /* var */_timesTxt: GTextFiled;

        /* internal */ /* var */_onekeyJuBtn: GLoadedButton;

        /* internal */ /* var */_onekeyGetBtn: GLoadedButton;

        /* internal */ /* var */_onekeyEatBtn: GLoadedButton;

        /* internal */ /* var */_packBtn: GLoadedButton;

        /* internal */ /* var */_getCheckBox: GCheckBox;

        /* internal */ /* var */_eatCheckBox: GCheckBox;

        /* internal */ /* var */_eatMingBaseItem: PetMingEatItem;

        /* internal */ /* var */_expTxt: GTextFiled;

        /* internal */ /* var */_msgRollTips: PetMingMsgRollTips;

        /* internal */ /* var */_flyIcon: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_guideTips: GuideTips;

        /* internal */ /* var */_levelItemArray: Array<any>;

        /* internal */ /* var */_halfTime: int=10;

        /* internal */ /* var */_suipianTxt: GTextFiled;

        /* internal */ /* var */dealUidArray: Array<any>;

        /* internal */ /* var */playTimer: Object /* flash.utils.Timer */;

        /* internal */ /* var */playArray: Array<any>;

        /* internal */ /* var */_closeGuide: Boolean;

        /* internal */ /* var */playIndex: int;

        /* internal */ /* var */_delay: int=0;
    }
